package com.hitqz.robot.biz.flow.component.gf;

import com.alibaba.fastjson.JSONObject;
import com.hitqz.robot.api.business.enums.RobotOtherCommandEnum;
import com.hitqz.robot.api.business.model.dto.FlowContextDto;
import com.hitqz.robot.api.business.model.dto.FlowPatrolPreAndEndTicketsDto;
import com.hitqz.robot.driver.parent.RobotDriverService;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @author xupkun
 * @date 2024/10/14
 */

@Slf4j
@LiteflowComponent(value = "WalkCheckPosComponent", name = "[光伏机器人]边运行边检测")
@RequiredArgsConstructor
public class WalkCheckPosComponent extends NodeComponent {

    private final RobotDriverService robotDriverService;
    @Override
    public void process() throws Exception {
        FlowContextDto dto = this.getRequestData();
        FlowPatrolPreAndEndTicketsDto ticketsDto = JSONObject.parseObject(dto.getTicketsTask().getParseOrderParams(), FlowPatrolPreAndEndTicketsDto.class);
        robotDriverService.executeOtherCommand(RobotOtherCommandEnum.SET_WORK_MODE, JSONObject.toJSONString(ticketsDto.getModalData()));
        log.info("设置清扫");
    }


}
